﻿using System;

namespace ConsoleApp11
{
    class Program
    {
        static void Main(string[] args)
        {
          
                DateTime dt = DateTime.Now;

                Console.WriteLine("当前日期为：{0}", dt);
                Console.WriteLine("当前时本月的第{0}天", dt.Day);
                Console.WriteLine("当前是：{0}", dt.DayOfWeek);
                Console.WriteLine("当前是本年度第{0}天", dt.DayOfYear);
                Console.WriteLine("30 天后的日期是{0}", dt.AddDays(30));
                Console.WriteLine("24小时之后的时间",dt.AddHours(24));
                Console.WriteLine("两个月之后的时间",dt.AddMonths(2));
            Console.WriteLine(dt.ToString ("yy-MM-dd"));
            Console.WriteLine(dt.Date);
            var firstDate = "2021-02-01";
            var fDate = Convert.ToDateTime(firstDate);
        
            var Date = fDate.AddDays(-1);
            Console.WriteLine(Date);

            string str = Console.ReadLine();
            Console.WriteLine("字符串的长度为：" + str.Length);
            Console.WriteLine("字符串中第一个字符为：" + str[0]);
            Console.WriteLine("字符串中最后一个字符为：" + str[str.Length - 1]);
            string d= "晓看天色暮看云，行也思君，做也思君";
           
            if (d .IndexOf("做") != -1)
            {
                d  = d .Replace("做", "坐");
            }
            Console.WriteLine("替换后的字符串为：" + d );
        }
    }
}
